﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using DocumentsTagger.DM;

namespace DocumentsTagger.UI.Commands
{
    /// <summary>
    /// This is a command for the menu item of decline suggested tag option.
    /// </summary>
    class DeclineSugestedTagCommand : ACommandBase
    {
        private readonly ViewModel.DocumentViewModel r_VM;
        static int cntr = 0;
        private readonly int currId;

        public DeclineSugestedTagCommand(ViewModel.DocumentViewModel documentViewModel)
        {
            this.r_VM = documentViewModel;
        }

        /// <summary>
        /// returns the ability to execute the command
        /// </summary>
        /// <param name="parameter">can be null</param>
        /// <returns>true if the command can be executed</returns>
        public override bool CanExecute(object parameter)
        {
            bool res = false;
            if (r_VM.SuggestedTags != null)
            {
                if (r_VM.SuggestedTags.Where(u => u.IsChecked == true).Count() >= 1)
                {
                    res = true;
                }
            }
            return res;
        }

        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="parameter">Can be null</param>
        public override void Execute(object parameter)
        {
            r_VM.DeclineSuggestedTags();
        }
    }
}
